package github.kawaiior.yuanchuxiuzhen.common.gongfa.pre;

import github.kawaiior.yuanchuxiuzhen.common.capability.entity.ManaPower;
import github.kawaiior.yuanchuxiuzhen.common.gongfa.GongFaBase;
import github.kawaiior.yuanchuxiuzhen.core.init.GongFaInit;
import github.kawaiior.yuanchuxiuzhen.core.registry.ModCapability;
import net.minecraft.block.Block;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.util.LazyOptional;

public class XuanShuiJue extends GongFaBase {
    public XuanShuiJue(String itemName) {
        super(ManaPower.ManaRoot.WATER, 2000, GongFaInit.EMPTY_GONG_FA, itemName);
    }

    @Override
    public void onPlayerLearn(PlayerEntity player, World world, ManaPower power) {

    }

    @Override
    public void onPlayerLearnFinish(PlayerEntity player, World world, ManaPower power) {
        power.addMaxMana(2000F);

    }

    public static void onPlayerAttack(PlayerEntity player, World world, float amount, ManaPower power){
        learn(player, world, power, amount);
    }

    private static void learn(PlayerEntity player, World world, ManaPower power, float amount){
        if (!power.isLearningGongFa(GongFaInit.XUAN_SHUI_JUE)){
            return;
        }

        power.addGongFaExp(player, world, (int) amount);
    }

}
